home *** CD-ROM | disk | FTP | other *** search
- Path: metropolis.nl!usura!joskam
- From: joskam@usura.metropolis.nl (Jurjen Oskam)
- Message-ID: <3151d7ce@usura.metropolis.nl>
- Newsgroups: comp.sys.amiga.programmer
- Subject: GCC floating point bug - please help!
- Date: 21 Mar 96 16:27:26 CET
- MIME-Version: 1.0
- Content-Type: text/plain; charset=iso-8859-1
- Content-Transfer-Encoding: 8bit
- Organization: * Open your mind! *
- X-GateSoftware: AmiGate 1.6b (28.1.96)
- X-CDA-fodder: shit fuck damn bestiality microsoft
-
- Hello everybody,
-
- Is there a mailinglist about the GCC compiler? The list at funet.fi seems to be
- inaccessible.
-
- -----start program-----
- #include <iostream.h>
-
- int main()
- {
- float kapitaal, rente, groeifactor;
- int jaar;
-
- cout << "starting amount: ";
- cin >> kapitaal;
- cout << "interest: ";
- cin >> rente;
-
- groeifactor = 1 + rente/100;
- cout << groeifactor << endl;
-
- for (jaar=1; jaar<=10; jaar++)
- {
- kapitaal *= groeifactor;
- cout << "after " << jaar << " years: " << kapitaal << endl;
- }
- }
- -----end program----
-
- I have two problems with this C++ program, compiled with the GCC compiler
- version 2.7.0 (is that the latest version, BTW) with no options.
-
- The first one is: it requires more than *800* KB of stack to compile properly!
- Is that normal?
-
- The second one is: it doesn't work right. It produces this output:
-
- -----start output-----
- starting amount: 1000
- interest: 5
- 1.05
- after 1 years: 11+0
- after 2 years: 1103.+
- after 3 years: 1157.62
- after 4 years: 122,.+1
- after 5 years: 13.,.3.
- after 6 years: 1340.1
- after 7 years: 141-.1
- after 8 years: 15.-.5,
- after 9 years: 2,+1.33
- after 10 years: 2,3/.//
- -----end output-----
-
- What are all those . + / signs doing there? If I enter an interest of 0 it
- works fine.
-
- Please help me with this problem! I'm taking a course in C++ programming at the
- moment, and I'd like to program at home. I do have experience with other
- programming languages.
-
- Thanks!
-
- --
- Jurjen Oskam -=*Finger joskam@metropolis.nl for PGP public key *=-
- Key fingerprint = E3 9F E7 5C 16 3B D2 B2 4F 86 BA 66 96 0C 44 F1
-
- ... We come in peace! Yet you go in pieces!
-